package com.ruoyi.system.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ProjectResearchMapper;
import com.ruoyi.system.domain.ProjectResearch;
import com.ruoyi.system.service.IProjectResearchService;
import com.google.common.collect.Lists;
import com.ruoyi.common.core.text.Convert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 项目调研Service业务层处理
 *
 * @author zhaonz
 * @date 2023-06-08
 */
@Service
public class ProjectResearchServiceImpl extends ServiceImpl<ProjectResearchMapper,ProjectResearch> implements IProjectResearchService
{
    private static final Logger logger = LoggerFactory.getLogger(ProjectResearchServiceImpl.class);

    @Autowired
    private ProjectResearchMapper projectResearchMapper;

    /**
     * 查询项目调研列表
     *
     * @param projectResearch 项目调研
     * @return 项目调研
     */
    @Override
    public List<ProjectResearch> list(ProjectResearch projectResearch)
    {
        return this.list(new QueryWrapper<>(projectResearch));
    }

    /**
     * 查询项目调研
     *
     * @param researchId 项目调研主键
     * @return 项目调研
     */
    @Override
    public ProjectResearch selectProjectResearchByResearchId(Long researchId)
    {
        return projectResearchMapper.selectProjectResearchByResearchId(researchId);
    }

    /**
     * 查询项目调研列表
     *
     * @param projectResearch 项目调研
     * @return 项目调研
     */
    @Override
    public List<ProjectResearch> selectProjectResearchList(ProjectResearch projectResearch)
    {
        return projectResearchMapper.selectProjectResearchList(projectResearch);
    }

    /**
     * 新增项目调研
     *
     * @param projectResearch 项目调研
     * @return 结果
     */
    @Override
    public int insertProjectResearch(ProjectResearch projectResearch)
    {
        projectResearch.setCreateTime(DateUtils.getNowDate());
        return projectResearchMapper.insertProjectResearch(projectResearch);
    }

    /**
     * 修改项目调研
     *
     * @param projectResearch 项目调研
     * @return 结果
     */
    @Override
    public int updateProjectResearch(ProjectResearch projectResearch)
    {
        projectResearch.setUpdateTime(DateUtils.getNowDate());
        return projectResearchMapper.updateProjectResearch(projectResearch);
    }

    /**
     * 批量删除项目调研
     *
     * @param researchIds 需要删除的项目调研主键
     * @return 结果
     */
    @Override
    public int removeByIds(String researchIds)
    {
        return this.baseMapper.deleteBatchIds(Lists.newArrayList(Convert.toStrArray(researchIds)));
    }

    /**
     * 批量删除项目调研
     *
     * @param researchIds 需要删除的项目调研主键
     * @return 结果
     */
    @Override
    public int deleteProjectResearchByResearchIds(String researchIds)
    {
        return projectResearchMapper.deleteProjectResearchByResearchIds(Convert.toStrArray(researchIds));
    }

    /**
     * 删除项目调研信息
     *
     * @param researchId 项目调研主键
     * @return 结果
     */
    @Override
    public int deleteProjectResearchByResearchId(Long researchId)
    {
        return projectResearchMapper.deleteProjectResearchByResearchId(researchId);
    }
}
